package org.jeecg.common.util;

import cn.hutool.core.util.StrUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * 数组格式的字符串转化成数组
 */
public class MyStringUtil {

    public static List<Integer> str2IntegerList(String ids) {
        if (ids == null || ids.trim().equals("") || ids.length() == 0) {
            return null;
        }
        ids = ids.substring(1, ids.length() - 1);
        int[] ints = StrUtil.splitToInt(ids, ",");
        List<Integer> integers = new ArrayList<>();
        for (int anInt : ints) {
            integers.add(anInt);
        }
        return integers;
    }
}
